<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page trimDirectiveWhitespaces="true" %>
<%@ page import="com.park.layout.Blocks" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%-- JSTL表达式（判断，循环，输出） --%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <%-- 方法表达式（字符串截取，替换） --%>
<%@ taglib uri="http://www.wanwei.com/tags/tag" prefix="layout" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<layout:override name="<%=Blocks.BLOCK_HEADER_CSS%>">
    <link href="Content/style/common/style.min.css?v=${static_resource_version}" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="Content/r/redactor/redactor.css" />
   <%-- <style>
        .redactor_form-control.redactor_editor{width: 1200px;}
    </style>--%>
</layout:override>

<layout:override name="<%=Blocks.BLOCK_HEADER_SCRIPTS%>">
    <script src="Content/lib/jquery/jquery.validate/jquery.validate.js?v=${static_resource_version}"></script>
    <script src="Content/lib/jquery/jquery.validate.unobtrusive/jquery.validate.unobtrusive.js?v=${static_resource_version}"></script>
    <script src="Content/app/article/article_settings.js?v=${static_resource_version}"></script>
    <script src="Content/r/redactor/redactor.js?v=${static_resource_version}"></script>
    <script>
        $(document).ready(function () {
            //jQuery.browser={};(function(){jQuery.browser.msie=false; jQuery.browser.version=0;if(navigator.userAgent.match(/MSIE ([0-9]+)./)){ jQuery.browser.msie=true;jQuery.browser.version=RegExp.$1;}})();
            // 配置表单校验
            $('#good_form').validate({
                ignore: ":hidden"
            });

            $('#redactor_content').redactor({
                maxWidth: 1200,
                minHeight: 300,
                //lang: "zh_cn",
                imageUpload: '<%=basePath%>cms/upload'
            });
        });
    </script>
</layout:override>

<layout:override name="<%=Blocks.BLOCK_BODY%>">
    <div class="container-fluid" style="text-align: left">
        <iframe id="good_form_target" name="goodFormTarget" style="display: none;"></iframe>
        <form id="good_form" class="form-horizontal" action="<%=basePath%>article/saveArticle" method="post" novalidate enctype="multipart/form-data" target="goodFormTarget">
            <input type="hidden" id="goodId" name="articleId" value="${articleId}">
            <input type="hidden" name="serviceType" value="1">
            <div class="panel panel-default">
                <div class="panel-heading">文章设置</div>
                <div class="panel-body">


                    <div class="col-sm-6">
                        <div class="form-group">
                            <label for="good_name" class="col-sm-4 control-label">
                                <span class="text-danger">*</span> 文章标题
                            </label>

                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="good_name" name="articleTitle"
                                       value="${articleTitle}" placeholder="文章名称" autocomplete="off"
                                       data-val="true" data-val-required="文章名称不能为空">
                                <div data-valmsg-for="goodName" data-valmsg-replace="true"></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="good_pic" class="col-sm-4 control-label">文章图片</label>

                            <div class="col-sm-8" style="float: left; width: 40%;">
                                <input type="file" id="good_pic" name="file" accept="image/*" value=""
                                       placeholder="文章图片" autocomplete="off" style="font-size: 12px;">
                                <div data-valmsg-for="goodPic" data-valmsg-replace="true"></div>
                            </div>
                            <c:if test="${articlePic != null}">
                            <div style="width: 80px; height: 80px; float: left" onmouseover="$(this).next().show();" onmouseout="$(this).next().hide();">
                                <img src="${articlePic}" style="width: 100%; height: 100%;" />
                            </div>
                            <div style="position: absolute; z-index: 99999; top: 130px; display: none;">
                                <img class="col-xs-3" src="${articlePic}" style="width: 100%; height: 100%;" />
                            </div>
                            </c:if>
                        </div>
                    </div>

                    <div class="col-sm-6">
                        <div class="form-group">
                            <label for="good_no" class="col-sm-4 control-label">
                                <span class="text-danger">*</span> 文章简介
                            </label>

                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="good_no" name="articleAbstract"
                                       value="${articleAbstract}" placeholder="文章标题" autocomplete="off"
                                       data-val="true" data-val-required="文章标题不能为空">
                                <div data-valmsg-for="goodNo" data-valmsg-replace="true"></div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="good_mode1" class="col-sm-4 control-label">
                                <span class="text-danger">*</span> 文章排序
                            </label>

                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="good_mode1" name="articleSeq"
                                       value="${articleSeq}" placeholder="文章排序，例如10，值越大越靠前" autocomplete="off"
                                       data-val="true" data-val-required="文章排序不能为空"
                                       data-val-regex-pattern="^[0-9]{1,}$"
                                       data-val-regex="文章排序格式错误">
                                <div data-valmsg-for="goodPrice" data-valmsg-replace="true"></div>
                            </div>
                        </div>

                    </div>

                    <div class="col-sm-12">
                        <div class="form-group">
                            <label for="redactor_content" class="col-sm-2 control-label">文章描述</label>

                            <div class="col-sm-10">
                            <textarea class="form-control" id="redactor_content" name="articleBody">${articleBody}</textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-4 col-sm-8">
                                <button type="button" class="btn btn-success col-sm-4 goods-setting">
                                    <span class="glyphicon glyphicon-ok"></span> 设置文章
                                </button>
                                <button type="button" class="btn col-sm-4" style="width: 150px; margin-left: 30px;" onclick="window.history.go(-1);">
                                    <span class="glyphicon"></span> 返回
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</layout:override>

<c:import url="../Shared/Layout.jsp">
    <c:param name="title" value="文章设置"/>
</c:import>
